<template>
<div class="goodsEvaluationInfo">
  <el-descriptions :column="3" border v-if="model">
    <el-descriptions-item>
      <template slot="label">
        订单号
      </template>
      {{ model.orderSn }}
    </el-descriptions-item>
    <el-descriptions-item>
      <template slot="label">
        商品名称
      </template>
      {{ model.productName }}
    </el-descriptions-item>
    <el-descriptions-item>
      <template slot="label">
        商品星级
      </template>
      {{ model.starLevel || '未评价' }}
    </el-descriptions-item>
    <el-descriptions-item>
      <template slot="label">
        包装完整星级
      </template>
    {{ model.packagingLevel || '未评价' }}
    </el-descriptions-item>
    <el-descriptions-item>
      <template slot="label">
        物流速度星级
      </template>
      {{ model.speedLevel || '未评价' }}
    </el-descriptions-item>
    <el-descriptions-item>
      <template slot="label">
        服务态度星级
      </template>
      {{ model.attitudeLevel || '未评价' }}
    </el-descriptions-item>
    <el-descriptions-item :span="3">
      <template slot="label">
        用户评价
      </template>
      <div>
        <span>{{model.content}}</span>
        <div v-if="model.urls">
          <y-upload-img
            :url="model.urls.split(',').map(url => ({url}))"
            value-type="ObjectArray"
            disabled
            business-sys-module-code="GOODS_EVALUATE">
          </y-upload-img>
        </div>
      </div>
    </el-descriptions-item>
    <el-descriptions-item :span="3">
      <template slot="label">
        回复评价
      </template>
      <el-input placeholder="请输入回复" type="textarea" v-model="model.replyContent" :autosize="{minRows: 3}" :maxlength="500" show-word-limit></el-input>
    </el-descriptions-item>
  </el-descriptions>
</div>
</template>

<script>
export default {
  name: "goodsEvaluationInfo",
  inject: ['generateMediaUrl'],
  props:{
    model: Object
  },
  methods:{
    submit(cbk){
      if(!this.model.replyContent){
        this.$message({
          type: 'warning',
          message: '请输入回复'
        });
      }else{
        let data = {
          commentId: this.model.id,
          content: this.model.replyContent,
          type: 0
        }
        if(this.model.replyId){
          data.id = this.model.replyId;
        }
        this.$yAxios({
          url: this.$api.goods.saveReplyEvaluate,
          data,
          loading: true
        }, info => {
          this.$message({
            type: 'success',
            message: '保存成功'
          });
          cbk && cbk();
        })
      }
    }
  }
}
</script>

<style scoped>

</style>